#encoding=utf-8
'''
Created on 2011-11-19

@author: guanyw

python version:2.6

'''
import unittest
from corpus.loader import sentence_to_triple_list, untag_sentence


class Test(unittest.TestCase):


    def test_sentence_to_triple_list(self):
        sents = '但 /c /O 对方 /n /O 否认 /v /O 并 /c /O '
        pair_list = sentence_to_triple_list(sents.strip())
        wd_list = [wd for wd,pos,tag in pair_list]
        pos_list = [pos for wd,pos,tag in pair_list]
        ne_list = [tag for wd,pos,tag in pair_list]

        assert wd_list,['但','对方','否认','并']
        assert pos_list,['/c','/n','/v','/c']
        assert ne_list,['/O']*4


    def test_untag_sentence(self):
        sents = '但 /c /O 对方 /n /O 否认 /v /b-sO 并 /c /O '
        sent_r = untag_sentence(sents)
        assert sent_r=='但对方否认并',True
        
if __name__ == "__main__":
    unittest.main()